﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="mtCmmtHierarchy.aspx.vb" Inherits="mtCmmtHierarchy" %>

<%@ Register Assembly="ISNet.WebUI.WebInput" Namespace="ISNet.WebUI.WebControls" TagPrefix="ISWebInput" %>

<%@ Register Assembly="ISNet.WebUI.WebTreeView" Namespace="ISNet.WebUI.WebTreeView" TagPrefix="ISWebTreeView" %>

<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>

<%@ Register Assembly="ISNet.WebUI.WebCombo" Namespace="ISNet.WebUI.WebCombo" TagPrefix="ISWebCombo" %>

<%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop" TagPrefix="ISWebDesktop" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <link href="script/style.css" rel="stylesheet" />
    <script src="script/tinybox.js"></script>
    <asp:ScriptManager ID="Scriptmanager1" runat="server">
    </asp:ScriptManager>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
    <div style="float: left; width: 97%; border: solid; border-color: gray; border-width: 1px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; text-align: right; padding: 5px 5px 5px 5px;">
        <div style="text-align: right; margin-top: 5px;">
            <div align="left" style="width: 600px; float: left">
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            </div>
            <script>
                function closeJS() {
                    var WebGrid1 = ISGetObject("WebGrid1");
                    WebGrid1.Refresh();
                }
                function addclick() {
                    var pytxt = document.getElementById('<%=PlanYearsTxt.ClientID%>').value
                    var gptxt = document.getElementById('<%=GroupTextBox.ClientID%>').value
                    var grid = ISGetObject("WebGrid1");
                    var row = grid.GetSelectedObject().GetRowObject();

                    TINY.box.show({ iframe: 'mtCmmtHierarchy_Add.aspx?CmmCode=' + row.KeyValue + '&PlanYear=' + pytxt + '&Group=' + gptxt, boxid: 'frameless', width: 400, height: 200, fixed: false, maskid: 'lightmask', maskopacity: 40, closejs: function () { closeJS() } });
                }
                function CustomRequest() {
                    if (confirm('กรุณายืนยันการลบข้อมูล') == false) {
                        return false
                    }
                    var grid = ISGetObject("WebGrid1");
                    grid.SendCustomRequest();
                    return true;
                }

                
            </script>
            <div style="float: right;">

                <table>
                    <tr>
                        <td>ประเภทกลุ่ม</td>
                        <td>
                            <asp:TextBox ID="GroupTextBox" runat="server" Width="50px" Text="1" onchange="SetFilter()"></asp:TextBox></td>
                        <td>Root Commitment Item</td>
                        <td>
                            <ISWebCombo:WebCombo ID="WebCombo1" AutoPostBack="true" Width="200px" runat="server" UseDefaultStyle="True" DataTextField="Description" DataValueField="id" Height="20px" OnInitializeDataSource="WebCombo1_InitializeDataSource">
                                <LayoutSettings AlwaysShowAllRowsOnDropdown="true" AlwaysShowHelpButton="false">
                                </LayoutSettings>
                            </ISWebCombo:WebCombo>

                        </td>
                        <td>ปี&nbsp;</td>
                        <td>
                            <asp:TextBox ID="PlanYearsTxt" AutoPostBack="true" runat="server" Width="50px" Enabled="true" Style="text-align: center;"></asp:TextBox></td>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;<asp:ImageButton ID="SearhBtn" runat="server" ImageUrl="Icons/search.jpg" ToolTip="แสดงโครงสร้าง Commitment Item ตามเงื่อนไขที่ระบุ" /> &nbsp;<asp:ImageButton ID="SaveBtn" runat="server" ImageUrl="Icons/save.jpg" Style="height: 21px" />
                        </td>
                    </tr>
                </table>

            </div>
        </div>
    </div>

    

    <div style="float: left; width: 100%">
        <table width="100%">
            <tr>
                <td align="center">
                    <ISWebGrid:WebGrid ID="WebGrid1" runat="server" UseDefaultStyle="True" Width="730px" DefaultStyleMode="Silver" Height="500px" OnInitializePostBack="WebGrid1_InitializePostBack" OnInitializeRow="WebGrid1_InitializeRow">
                        <LayoutSettings>
                            <RowStyle Font-Names="Tahoma" Font-Size="9" CustomRules="overflow: hidden;" />

                        </LayoutSettings>
                        <RootTable DataKeyField="id">
                            <SelfReferencingSettings ChildDataMember="ParentCode" Enabled="True" ExpandColumnMember="Description"
                                ParentDataMember="id" />
                            <Columns>
                                <ISWebGrid:WebGridColumn Name="Description" Width="600px" Caption="Name" DataMember="Description">
                                    <HeaderStyle HorizontalAlign="Center" Width="600px" />
                                    <CellStyle HorizontalAlign="Left" />

                                </ISWebGrid:WebGridColumn>

                                <ISWebGrid:WebGridColumn Name="Action" Width="100px" Caption=" " DataMember="" ColumnType="Template">
                                    <CellTemplate>

                                        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Icons/ic_new.png" OnClientClick="addclick(); return false;" ToolTip="เพิ่ม Commitment Item ใต้ลำดับ" />
                                        <asp:ImageButton ID="delete_btn" runat="server" ImageUrl="~/Icons/ic_delete.png" OnClientClick="CustomRequest(); return false" ToolTip="ลบCommitment Item ใต้ลำดับ" />

                                    </CellTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    <CellStyle HorizontalAlign="Right" />
                                </ISWebGrid:WebGridColumn>
                            </Columns>
                        </RootTable>

                    </ISWebGrid:WebGrid>

                </td>
            </tr>
        </table>

    </div>
    <script>
        <%=ScriptText%>

        function SetFilter() {
            var CmmtGroup
            CmmtGroup = document.getElementById('<%=GroupTextBox.ClientID%>').value
            var WebCombo1 = ISGetObject("WebCombo1");
            WebCombo1.ClearAdditionalFilters();
            WebCombo1.SetAdditionalFilters("[CmmtGroup] = '" + CmmtGroup + "'");
        }
    </script>
                                                </ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

